import React from 'react'
import UploadFileModal from '@/components/UploadFileModal'
import styles from './errorModals.less'
import icon_warning from '@/assets/icons/icon-warning-tip.png'

interface ErrorModalProps {
  msg: string;
  visible: boolean;
  onCancel: () => void;
  onOk: () => void;
  img?:string;
}

const ErrorModal = (props: ErrorModalProps) => {
  const { msg, visible, onCancel, onOk, img } = props
  return (
    <UploadFileModal
      bodyStyle={{ display: 'flex', paddingRight: 14, alignItems: 'center' }}
      modalWidth={400}
      visible={visible}
      toggleModal={onCancel}
      handleOk={onOk}
    >
      <div className={styles.errorModalContent}>
        <img src={img || icon_warning} alt="warning" />
        <span>{msg}</span>
      </div>
    </UploadFileModal>
  )
}

export default ErrorModal